﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Castle.Windsor;
using Castle.Windsor.Configuration.Interpreters;
using Castle.Core;
using Guoc.DAL.Common;
namespace Guoc.DAL.CastleIOC
{
    /// <summary>
    /// 容器工厂
    /// </summary>
    /// <typeparam name="T">必须是 Guoc.DAL.Interface 里的接口</typeparam>
   public class IocFactory<T> where T:IBase
    {
       static readonly WindsorContainer _wcontainer = new WindsorContainer(new XmlInterpreter());

       public static T GetService(T t) {
           t = _wcontainer.Resolve<T>();         
           return t;
       }

       public static T GetService() {
           T t = _wcontainer.Resolve<T>();
           return t;
       }

    }
}
